<template>
  <div class="pageInation">
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pageSize"
      layout="total, prev, pager, next, sizes, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: {
    total: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      currentPage: 1,
      pageSize: 10,
      // total: 0,
    };
  },
  methods: {
    handleSizeChange(size) {
      this.pageSize = size;
      this.$emit("handleCurrentChange", {
        currentPage: this.currentPage,
        pageSize: this.pageSize,
      });
    },
    handleCurrentChange(pageNum) {
      this.currentPage = pageNum;
      this.$emit("handleCurrentChange", {
        currentPage: this.currentPage,
        pageSize: this.pageSize,
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.pageInation {
  width: 100%;
  height: 45px;
  ::v-deep .el-pagination {
    height: 45px;
    position: relative;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    .el-pagination__total {
      position: absolute;
      left: 5px;
    }
  }
}
</style>
